/*
 * This file is a part of qloudgen-esb. 
 * You can redistribute qloudgen-esb and/or modify it under the terms of the Lesser GNU General Public License version 3. 
 * qloudgen-esb is distributed WITHOUT ANY WARRANTY. 
 * 
 * See the Lesser GNU General Public License for more details at http://www.gnu.org/licenses/.
 *  
 * Copyright (C) 2014 Qloudgen Technology
*/

package com.qloudgen.csb;

import org.apache.log4j.Logger;

public class CSBErrorHandler implements ErrorHandler {
	
    private static Logger LOG = Logger.getLogger(CSBErrorHandler.class.getName());

	@Override
	public void OnError(int errorCode, long offset) {
    	if(errorCode == ZmqConsumerBase.UNREACHABLE)
    		LOG.error("unreachable: " + offset);
    	else if(errorCode == ZmqConsumerBase.TIMEOUT)
    		LOG.error("timeout: " + offset);   	
    	else if(errorCode == ZmqConsumerBase.INTERRUPTED)
    		LOG.error("interrupted: " + offset);
	}
}

